use "$basein/Datos adicionales/base_Contraste.dta", clear
keep treatgroup2 school_id
merge m:1 school_id using "$basein/Datos adicionales/Experimento_id.dta", gen(experimento)
drop experimento
merge m:1 school_id using "$basein/Datos adicionales/estratos.dta", gen(_estrato)
keep if _estrato==3
keep if state==3
egen super_strata=group(estrato parejas_Gua parejas_taba),missing

sort super_strata
preserve
tempfile tmp
bysort super_strata: keep if _n == 1
sample 50
sort super_strata
save `tmp'
restore
merge m:1 super_strata using `tmp'
keep if _merge == 3
drop _merge 
		
keep school_id	
export delim "$base_out/Sample_guanajuato.csv"